@model Rework.CommerceHistory.ViewModels.ProductRolesViewModel

<fieldset>
    <legend>@T("Roles Applied Once Product Purchased")</legend>
    @if (Model.Roles.Count > 0) {
        var index = 0;
        foreach (var entry in Model.Roles) {
            if (string.Equals(entry.Name, "Authenticated", StringComparison.OrdinalIgnoreCase) || string.Equals(entry.Name, "Anonymous", StringComparison.OrdinalIgnoreCase)) {
                continue;
            }

            @Html.Hidden("Roles[" + index + "].RoleId", entry.RoleId)
            @Html.Hidden("Roles[" + index + "].Name", entry.Name)

    <div>
        @Html.CheckBox("Roles[" + index + "].Granted", entry.Granted)
        <label class="forcheckbox" for="@Html.FieldIdFor(m => m.Roles[index].Granted)">@entry.Name</label>
    </div>
            index++;
        }
    }
    else {
    <p>@T("There are no roles.")</p>
    }

    <div>
        @Html.LabelFor(m => m.NumberOfPeriods, @T("Number of Periods - use 0 for unlimited"))
        @Html.EditorFor(m => m.NumberOfPeriods)
        @Html.ValidationMessageFor(m => m.NumberOfPeriods, "*")
    </div>
    <div>
        @Html.LabelFor(m => m.PeriodType, @T("Period Type"))
        @Html.DropDownListFor(m => m.PeriodType, Model.PeriodTypes)
        @Html.ValidationMessageFor(m => m.PeriodType, "*")
    </div>
</fieldset>
